<?php
namespace Home\Controller;
use Think\Controller;
class ZhuanjiaController extends Controller {
    public function index(){
        $zMO = M('zhuanjia');  
        $tCount = $zMO->count();
        $tPage = new \Think\Page($tCount,1);
        $tShow = $tPage->show();
        $tData = $zMO->order('id desc')->limit($tPage->firstRow.','.$tPage->listRows)->select();
        $this->assign('tPage',$tShow);// 赋值分页输出
        $this->assign('tData' , $tData);
        $this->display();

    }
    public function detail(){
        $pId = I('id','','int');
        if(empty($pId)){
            $this->error('ID错误'); 
        }
        $tM = M('zhuanjia');
        $tRow = $tM->field('*')->where('id = ' . $pId)->find();
        $this->assign('tRow',$tRow);
        $this->display();
    }
}
